home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 290_02 / skeleton.h < prev    next >
C/C++ Source or Header  |  1990-05-12  |  1KB  |  45 lines

  1. /* macro definitions for compressed-table C/FTL programs generated by flex */
  2. #include <stdlib.h>     /* exit() prototype */
  3. #include <io.h>         /* read(), write() prototypes */
  4. #include "skelcom.h"
  5.  
  6.  
  7. /* reinitializes everything except the current start condition.  The last
  8.  * input character is set to a newline so an initial beginning-of-line
  9.  * rule will match
  10.  */
  11. #define YY_INIT \
  12.     { \
  13.     yyleng = yy_c_buf_p = yy_e_buf_p = 0; \
  14.     yy_hold_char = yy_ch_buf[yy_c_buf_p] = '\n'; \
  15.     yytext = &yy_ch_buf[yy_c_buf_p]; \
  16.     yy_saw_eof = 0; \
  17.     }
  18.  
  19. /* returns the length of the matched text */
  20. #define YY_LENG (yy_c_buf_p - yy_b_buf_p + 1)
  21.  
  22. /* done before the next pattern has been matched action */
  23. #define YY_DO_BEFORE_SCAN \
  24.     yytext[yyleng] = yy_hold_char;
  25.  
  26. /* done after the current pattern has been matched and before the corresponding action */
  27. #define YY_DO_BEFORE_ACTION \
  28.     yytext = &yy_ch_buf[yy_b_buf_p]; \
  29.     yyleng = YY_LENG; \
  30.     yy_hold_char = yytext[yyleng]; \
  31.     yytext[yyleng] = '\0';
  32.  
  33. /* find the next rule matched */
  34. #ifdef FLEX_REJECT_ENABLED
  35. #define REJECT \
  36.         { \
  37.     YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */ \
  38.     yy_c_buf_p = yy_full_match; /* restore possibly backed-over text */ \
  39.         ++yy_lp; \
  40.         goto find_rule; \
  41.         }
  42. #else
  43. #define REJECT YY_FATAL_ERROR( "REJECT used and scanner was not generated using -r" )
  44. #endif
  45.